package com.risk.management.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.beans.factory.annotation.Value;

@Configuration
public class FileUploadConfig {
    
    @Value("${file.upload.maxSize:10485760}") // 默认10MB
    private long maxUploadSize;
    
    @Value("${file.upload.path:/uploads}")
    private String uploadPath;
    
    @Bean
    public CommonsMultipartResolver multipartResolver() {
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
        resolver.setMaxUploadSize(maxUploadSize);
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }
    
    public String getUploadPath() {
        return uploadPath;
    }
} 